package br.gov.ibama.client.componentes;

import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.HasClickHandlers;

public class BotaoImprimirController {

	private final HasClickHandlers botao;
	private final Canvas alvo;

	public BotaoImprimirController(HasClickHandlers botao, Canvas alvo) {
		this.botao = botao;
		this.alvo = alvo;
	}

	public void inicializa() {
		this.botao.addClickHandler(new ClickHandler() {

			public void onClick(ClickEvent event) {
				doImprime();
			}
		});
	}

	protected void doImprime() {
		Canvas.showPrintPreview(alvo);
	}

}
